// import { getChannelData, getChannelDataBySearch }
// from '@/services/more';
const model = {
  namespace: 'more',
  state: {
    data: [{name: '哈哈'}]
  },
  effects: {
    * getMoreData(action, {
      call,
      put
    }) {
      const res = yield call(getChannelData,
        action.payload);
      // 更新数据
      yield put({
        type: 'moreData',
        payload: res
      });
    },
    // *getMoreDataBySearch(action, { call, put }) {
    // web全栈架构师
    // const res = yield
    // call(getChannelDataBySearch, action.payload);
    // // 更新数据
    // yield put({ type: 'moreData', payload: res
  });
},
},
reducers: {
  moreData(state, {
    payload
  }) {
      console.log('moreData: ', state, payload);
    // 返回⼀个新的state
    return {
      ...state,
      data: [...state.data, payload.data],
    };
  },
},
};
export default model;
